package com.sun.service.impl;

import com.sun.dao.DeptMapper;
import com.sun.dao.MenuMapper;
import com.sun.pojo.Dept;
import com.sun.pojo.Menu;
import com.sun.service.DeptService;
import com.sun.service.MenuService;
import com.sun.vo.DeptVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

@Service
@Transactional
public class DeptServiceImpl implements DeptService {

    @Autowired
    private DeptMapper deptMapper;


    public List<Dept> findDeptListByPage(DeptVo deptVo) {
        return deptMapper.findDeptListByPage(deptVo);
    }

    public int addDept(Dept dept) {
        dept.setCreateDate(new Date());
        return deptMapper.addDept(dept);
    }

    public int updateDept(Dept dept) {
        return deptMapper.updateDept(dept);
    }

    public int deleteDept(int deptId) {
        return deptMapper.deleteDept(deptId);
    }

    public List<Dept> findAllDept() {
        return deptMapper.findAllDept();
    }
}
